package com.cy.pj.health.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class TemplateController {
    @RequestMapping("/default")
    public String doTemplateUI(Model model){
        /**
         * return的default会传给DispatcherServlet
         * 这个view名字交给viewResolver解析
         *      (1)将view名字添加前缀和后缀(例如:/templates/default.html)
         *      (2)对html页面中的元素进行解析
         */
        model.addAttribute("name","default");
        return "default";
    }
    @RequestMapping("/list")
    public String doThymeleaf(Model model){
        List list=new ArrayList();
        list.add("1234");
        list.add("fag");
        list.add("34gfv");
        list.add("nrw-=-");
        model.addAttribute("list", list);
        return "default";
    }
}
